﻿using Microsoft.EntityFrameworkCore.Migrations;
using MySql.EntityFrameworkCore.Metadata;

#nullable disable

namespace SCRS.Dal.Migrations
{
    public partial class v102 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<string>(
                name: "USERNAME",
                table: "SYS_ACCOUNT",
                type: "varchar(64)",
                maxLength: 64,
                nullable: false,
                comment: "用户名",
                oldClrType: typeof(string),
                oldType: "longtext");

            migrationBuilder.AlterColumn<string>(
                name: "ROLE",
                table: "SYS_ACCOUNT",
                type: "json",
                nullable: false,
                comment: "角色",
                oldClrType: typeof(string),
                oldType: "json");

            migrationBuilder.AlterColumn<string>(
                name: "PASSWORD",
                table: "SYS_ACCOUNT",
                type: "Char(32)",
                maxLength: 32,
                nullable: false,
                comment: "密码",
                oldClrType: typeof(string),
                oldType: "varchar(32)",
                oldMaxLength: 32);

            migrationBuilder.AlterColumn<string>(
                name: "NAME",
                table: "SYS_ACCOUNT",
                type: "varchar(64)",
                maxLength: 64,
                nullable: false,
                comment: "姓名",
                oldClrType: typeof(string),
                oldType: "longtext");

            migrationBuilder.AlterColumn<string>(
                name: "FACE_CODE",
                table: "SYS_ACCOUNT",
                type: "json",
                nullable: true,
                comment: "人脸识别编码",
                oldClrType: typeof(string),
                oldType: "json",
                oldNullable: true);

            migrationBuilder.AlterColumn<int>(
                name: "ID",
                table: "SYS_ACCOUNT",
                type: "int",
                nullable: false,
                comment: "主键",
                oldClrType: typeof(int),
                oldType: "int")
                .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn)
                .OldAnnotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<string>(
                name: "USERNAME",
                table: "SYS_ACCOUNT",
                type: "longtext",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(64)",
                oldMaxLength: 64,
                oldComment: "用户名");

            migrationBuilder.AlterColumn<string>(
                name: "ROLE",
                table: "SYS_ACCOUNT",
                type: "json",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "json",
                oldComment: "角色");

            migrationBuilder.AlterColumn<string>(
                name: "PASSWORD",
                table: "SYS_ACCOUNT",
                type: "varchar(32)",
                maxLength: 32,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "Char(32)",
                oldMaxLength: 32,
                oldComment: "密码");

            migrationBuilder.AlterColumn<string>(
                name: "NAME",
                table: "SYS_ACCOUNT",
                type: "longtext",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(64)",
                oldMaxLength: 64,
                oldComment: "姓名");

            migrationBuilder.AlterColumn<string>(
                name: "FACE_CODE",
                table: "SYS_ACCOUNT",
                type: "json",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "json",
                oldNullable: true,
                oldComment: "人脸识别编码");

            migrationBuilder.AlterColumn<int>(
                name: "ID",
                table: "SYS_ACCOUNT",
                type: "int",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int",
                oldComment: "主键")
                .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn)
                .OldAnnotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn);
        }
    }
}
